﻿<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>
        Property integrated with INotifyPropertyChanged
      </Title>
      <Shortcut>propnpc</Shortcut>
      <Description>Creates a property with a simple public getter and a public setter that raises INotifyPropertyChanged.PropertyChanged if the value changes.</Description>
      <Author>Dwayne Need</Author>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
    </Header>
    <Snippet>
      <Declarations>
        <Literal>
          <ID>type</ID>
          <ToolTip>Property type</ToolTip>
          <Default>int</Default>
        </Literal>
        <Literal>
          <ID>property</ID>
          <ToolTip>Property name</ToolTip>
          <Default>Foo</Default>
        </Literal>
        <Literal>
          <ID>field</ID>
          <ToolTip>The variable backing this property</ToolTip>
          <Default>_foo</Default>
        </Literal>
      </Declarations>
      <Code Language="csharp">
<![CDATA[private $type$ $field$;
public $type$ $property$
{
    get { return $field$;}
    set
    {
        if(value != $field$)
        {
            $field$ = value;
                
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs("$property$"));
            }
        }
    }
}
$end$]]>
      </Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>
